*special problem bitmasks

Please click on ads to support us..

Python Code:

s="{:06b}".format(int(input()))
print(int(s[0]+s[5]+s[3]+s[2]+s[4]+s[1],2))

C++ Code:

#include <bits/stdc++.h>

using namespace std;

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define ff first
#define ss second
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define mp make_pair
#define ld long double
#define uset unordered_set
#define umap unordered_map
#define umset unordered_multiset
#define ummap unordered_multimap
#define pii pair<int, int>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define pll pair<long long, long long>
#define bint __int128

//#pragma GCC optimize("O3,unroll-loops")
//#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")

inline void solve() {
    vector<int> to(6);
    to[0] = 4;
    to[1] = 1;
    to[2] = 3;
    to[3] = 2;
    to[4] = 0;
    to[5] = 5;
    int a;
    cin >> a;
    int b = 0;
    for (int bit = 5; bit > -1; bit--)
        if ((a >> bit) & 1)
            b |= (1 << to[bit]);
    cout << b << '\n';
}

signed main() {
#ifndef DEBUG
    std::ios_base::sync_with_stdio(0);
    std::cin.tie(0);
    std::cout.tie(0);
#endif
    int tt = 1;
#ifdef DEBUG
    std::cin >> tt;
#endif
    while (tt--) {
#ifdef DEBUG
        std::cout << "Test case#\n";
#endif
        solve();
    }
    return 0;
}


Comments

Submit
0 Comments
More Questions

1574A - Regular Bracket Sequences
1574B - Combinatorics Homework
1567A - Domino Disaster
1593A - Elections
1607A - Linear Keyboard
EQUALCOIN Equal Coins
XOREQN Xor Equation
MAKEPAL Weird Palindrome Making
HILLSEQ Hill Sequence
MAXBRIDGE Maximise the bridges
WLDRPL Wildcard Replacement
1221. Split a String in Balanced Strings
1002. Find Common Characters
1602A - Two Subsequences
1555A - PizzaForces
1607B - Odd Grasshopper
1084A - The Fair Nut and Elevator
1440B - Sum of Medians
1032A - Kitchen Utensils
1501B - Napoleon Cake
1584B - Coloring Rectangles
1562B - Scenes From a Memory
1521A - Nastia and Nearly Good Numbers
208. Implement Trie
1605B - Reverse Sort
1607C - Minimum Extraction
1604B - XOR Specia-LIS-t
1606B - Update Files
1598B - Groups
1602B - Divine Array